check for nil in ensure part

peter-x 10 years ago
parent
commit
cd6fe29890
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/models/agents/imap_folder_agent.rb

+ 1 - 1
app/models/agents/imap_folder_agent.rb

@@ -372,7 +372,7 @@ module Agents
372 372
           imap = new(host, port, ssl)
373 373
           yield imap
374 374
         ensure
375
-          imap.disconnect
375
+          imap.disconnect unless imap.nil?
376 376
         end
377 377
       end
378 378